package com.calm.logincenter;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        HookAms hookAms = new HookAms();
        try {
            hookAms.hookAms(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void login(View view) {
        startActivity(new Intent(this,LoginActivity.class));
    }

    public void exitLogin(View view) {
        SharedPreferences sharedPreferences = getSharedPreferences("CALM", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean("login",false);
        editor.apply();
    }

    public void toActivity1(View view) {
        Intent intent = new Intent(this,OneActivity.class);
        Bundle bundle = new Bundle();
        bundle.putInt("PARAMS1",999);
        intent.putExtras(bundle);
        intent.putExtra("PARAMS0","CALM");
        startActivity(intent);
    }

    public void toActivity2(View view) {
        startActivity(new Intent(this,TowActivity.class));
    }
}